<div class="form">

<?php $form = $this->beginWidget('GxActiveForm', array(
	'id' => 'widgets-form',
	'enableAjaxValidation' => true,
));
?>
	<div class="mini-bl2">
	<table>
		<tr>
			<td><?php echo $form->labelEx($model,'published'); ?></td>
			<td><?php echo $form->checkBox($model, 'published'); ?></td>
			<td><?php echo $form->labelEx($model,'created'); ?></td>
			<td>
			<?php 
			$this->widget('ext.widgets.CJuiDateTimePicker.CJuiDateTimePicker',array(
		        'model'=>$model, //Model object
		        'attribute'=>'created', //attribute name
		        'mode'=>'datetime', //use "time","date" or "datetime" (default)
				'options'=>array()
		    ));
			?>
			</td>
		</tr>
		<tr>
			<td><?php echo $form->labelEx($model,'show_title'); ?></td>
			<td><?php echo $form->checkBox($model, 'show_title'); ?></td>
			<td><?php echo $form->labelEx($model,'created_by'); ?></td>
			<td><?php echo $model->created_by; ?></td>
		</tr>
		<tr>
			<td><?php echo $form->labelEx($model,'ordering'); ?></td>
			<td><?php echo $form->textField($model, 'ordering'); ?></td>
			<td><?php echo $form->labelEx($model,'modified'); ?></td>
			<td><?php 
			$this->widget('ext.widgets.CJuiDateTimePicker.CJuiDateTimePicker',array(
		        'model'=>$model, //Model object
		        'attribute'=>'modified', //attribute name
		        'mode'=>'datetime', //use "time","date" or "datetime" (default)
				'options'=>array()
		    ));
			?></td>
		</tr>
		<tr>
			<td><?php echo $form->labelEx($model,'position'); ?></td>
			<td><?php echo $form->textField($model, 'position', array('maxlength' => 50)); ?></td>
			<td><?php echo $form->labelEx($model,'modified_by'); ?></td>
			<td><?php echo $model->modified_by; ?></td>
		</tr>
		<tr>
			<td><?php echo $form->labelEx($model,'timecache'); ?></td>
			<td><?php echo $form->textField($model, 'timecache', array('maxlength' => 11)); ?></td>
		</tr>
	</table>
	</div>

	<?php echo $form->errorSummary($model); ?>
		<?php echo $form->error($model,'widget_name'); ?>
		<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model, 'title', array('maxlength' => 255, 'class'=>'textField-l')); ?>
		<?php echo $form->error($model,'title'); ?>
		</div><!-- row -->
		<div class="row" style="display: none;">
		<?php 
			$model->widget_name = ($model->widget_name!='')?$model->widget_name:$widget_name;
			echo $form->textField($model, 'widget_name',array('maxlength' => 255));
		?>
		</div><!-- row -->
		
		<?php if($model->widget_name!=''):?>
		<div class="row">
			<fieldset><legend>Params</legend>
			<?php 
					$wd = new $model->widget_name;
					$wd->buildParams($model->params);
			?>
			</fieldset>
		</div>
		<?php else:?>
			<div class="row">
				<fieldset><legend>Params</legend>
				<?php 
						$wd = new $widget_name;
						$wd->buildParams();
				?>
				</fieldset>
			</div>
		<?php endif;?>

<?php
echo GxHtml::submitButton(Yii::t('app', 'Save'), array('id'=>'s-bt','style'=>'display: none'));
$this->endWidget();
?>
</div><!-- form -->